# coding=utf-8
import sys,os
os.chdir(os.path.dirname(os.path.abspath(__file__)))
from PyQt5.QtGui import *
from PyQt5.QtCore import *
from PyQt5.QtWidgets import *
from PyQt5.QtWebEngineWidgets import *
import configparser
import datetime
cp = configparser.ConfigParser()
cp.read("config.ini")

print(cp.sections())  
print(cp.options("db"))
name = cp.get("db","name")
print(name)
url = cp.get("db","url")
print(url)

from PyQt5.QtWidgets import QMessageBox


class MainWindow(QMainWindow):
    def __init__(self, *args, **kwargs):
        super().__init__(*args, **kwargs)
        self.setWindowTitle(name)
        #self.setWindowIcon(QIcon('icons/favicon.ico'))
        self.resize(1000, 600)
        self.show()
        day = datetime.datetime.now().strftime('%Y-%m-%d')
        if day>'2099-04-30':
            self.setToolTip('')
            QMessageBox.warning(self, '提示', '试用过期，请联系guoff.taobao.com')
        else:
            self.setToolTip('未过期')

            #url = "https://guofeifei.com"
            self.browser = QWebEngineView()
            self.browser.load(QUrl(url))
            self.setCentralWidget(self.browser)

if __name__=='__main__':
    app = QApplication(sys.argv)
    window = MainWindow()
    window.show()
    sys.exit(app.exec_())
